import { request } from '@/utils/request';

/**
 * 添加
 * @param data
 * @returns
 */
export function addManager(data: API.UserManagerItem) {
  return request<API.BaseResult>(
    {
      url: '/mgUser/addManager',
      method: 'post',
      data,
    },
    {
      isGetDataDirectly: false,
    },
  );
}

/**
 * 删除
 * @param params
 * @returns
 */
export function deleteManager(data: API.UserManagerItem) {
  return request<API.BaseResult>(
    {
      url: '/mgUser/deleteManager',
      method: 'post',
      data,
    },
    {
      isGetDataDirectly: false,
    },
  );
}

/**
 * 按Id查询
 * @param params
 * @returns
 */
export function selectManagerById(params: API.UserManagerItem) {
  return request<API.BaseResult>(
    {
      url: '/mgUser/selectManagerById',
      method: 'get',
      params,
    },
    {
      isGetDataDirectly: false,
    },
  );
}

/**
 * 查询所有
 * @returns
 */
export function selectAllManager() {
  return request<API.UserManagerItem[]>(
    {
      url: '/mgUser/selectAllManager',
      method: 'get',
    },
    {
      isGetDataDirectly: true,
    },
  );
}

/**
 * 分页获取数据
 * @param params
 * @returns
 */
export function selectAllByPage(params: API.PageParams) {
  return request<API.SeachResult<API.UserManagerItem[]>>(
    {
      url: '/mgUser/selectAllByPage',
      method: 'get',
      params,
    },
    {
      isGetDataDirectly: true,
    },
  );
}

/**
 * 更新
 * @param data
 * @returns
 */
export function updateManager(data: API.UserManagerItem) {
  return request<API.BaseResult>(
    {
      url: '/mgUser/updateManager',
      method: 'post',
      data,
    },
    {
      isGetDataDirectly: false,
    },
  );
}
